package com.corelibs.corelibsdemo

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.corelibs.corelibsdemo.databinding.FragmentTestBinding
import com.corelibs.expand.showToast
import com.lib.core.base.BaseFragment
import com.lib.core.base.BaseViewModel

// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private const val ARG_PARAM1 = "param1"
private const val ARG_PARAM2 = "param2"

/**
 * A simple [Fragment] subclass.
 * Use the [TestFragment.newInstance] factory method to
 * create an instance of this fragment.
 */
class TestFragment : BaseFragment<FragmentTestBinding, TestViewModel>() {
    private var param1: String? = null
    private var param2: String? = null


    override fun initView() {
        binding.textView.setOnClickListener {
            viewModel.changeText {
                binding.textView.text = it
            }
        }

    }


    companion object {
        @JvmStatic
        fun newInstance(param1: String, param2: String) =
            TestFragment().apply {
                arguments = Bundle().apply {
                    putString(ARG_PARAM1, param1)
                    putString(ARG_PARAM2, param2)
                }
            }
    }
}